package com.rt.cloud.auth.config.login;

import org.springframework.context.ApplicationListener;
import org.springframework.security.authentication.event.AuthenticationSuccessEvent;
import org.springframework.stereotype.Component;

@Component
public class AuthenticationSuccessListener implements ApplicationListener<AuthenticationSuccessEvent> {

    // e : principle:{username, authoritis, enable...} , no token
    @Override
    public void onApplicationEvent(AuthenticationSuccessEvent e) {
        //在这里记录登陆失败的次数
        String username = e.getAuthentication().getPrincipal().toString();
        // System.out.println("AuthenticationSuccessListener:"+ username);
    }
}
